<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>收银员</title>
		<link rel="stylesheet" href="__AGENT__/css/iconfont.css" />
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
	</head>

	<body>
		{include file="public/header" /}
		<div class="index_conbox">
			<div class="index_content clearfix">
				{include file="public/lefter" /}
				<div class="right"><!--右侧内容-->
					<div class="rigtop">
						<span class="title">收银员</span>
					</div>
					<div class="indrig_con" style="position: relative;">
						<div class="zizh_btnbox" style="top: -58px;right: 20px;">
							<button class="zizh_btn" type="button" onclick="cashier_add()"><i class="iconfont icon-jia"></i>创建收银员</button>
						</div>
						<div class="zizh_conbox" style="padding-top: 20px;">
							<!--选项卡内容开始-->
							<form id="my_form" action="{:url('store/cashier_manage')}" method="post">
							<div class="zizh_con_1">
								<div class="chax_rowbox clearfix">
									<div class="chax_rowbox clearfix">
										<div class="shxx_row clearfix">
							            <div class="left">收银员：</div>
							            <div class="right clearfix">
											<input type="text" name="namea" placeholder="输入收银员名字" class="chax_input" />
							            </div>
						        	</div>
							        <div class="shxx_row clearfix">
							            <div class="left">门店：</div>
							            <div class="right clearfix">
							                <div id="htselect">
												<select name="chain_id">
													<option value="0">全部</option>
													{volist name="typelist" id="vo"}
													<option value="{$vo.id}">{$vo.store_name}</option>
													{/volist}
												</select>
											</div>
							            </div>
							        </div>
							        <div class="shxx_row clearfix">
							             <button  type="submit" onclick="return check_time()" class="htcxbtn">搜索</button>
							        </div>
								</div>
								</form>
								<div class="chax_conbox">
									<div class="chax_jiegnr">
										<table class="zizh_table1 zizh_table2">
											<thead>
												<tr>
													<th class="w_20">收款二维码 | 收银员</th>
													<th class="w_10">电话</th>
													<th class="w_20">添加时间</th>
													<th class="w_10">状态</th>
													<th class="w_10">职位</th>
													<th class="w_10">归属门店</th>
													<th class="w_10">操作</th>
												</tr>
											</thead>
											<tbody id="tbody">
												{volist name="data" id="vo" empty="$empty"}
												<tr>
													<td>{if $vo.state==1}
															<a class="iconfont icon-erweima"  href="javascript:;" onclick="fukuan_s('{$vo.id}')">
														{/if}
														</a>{$vo.name}
													</td>
													<td>{$vo.mobile}</td>
													<td>{$vo.add_time}</td>
													<td>
													{switch name="$vo.state"}
													    {case value="1"}在职{/case}
													    {default /}离职
														{/switch}
													</td>
													<td>
														{switch name="$vo.ctype"}
													    {case value="2"}店长{/case}
													    {default /}收银员
														{/switch}
														</td>
													<td>{$vo.store_name}</td>
													<td>
														<a onclick="cashier_edit('{$vo.id}')">编辑</a>
														<a onclick="cashier_del('{$vo.id}')" style="margin-top: 2px;">删除</a>
													</td>
												</tr>
												{/volist}
											</tbody>
										</table>
										<div class="fenye" style="display: block;">
											<ul class="pagination">
												{$data->render()}
											</ul>
										</div>
									</div>
								</div>
							</div>
						</div>

					</div>
				</div>
			</div>
		</div>
		{include file="public/footer" /}
		<script>
			function fukuan_s(clerk_id) {
				var url = 'fukuan_s?clerk_id='+clerk_id;
				layer.open({
				  type: 2,
				  title: '收银员收款二维码',
				  shadeClose: true,
				  shade: 0.8,
				  area: ['426px', '658px'],
				  content: [url]
				}); 
			}
			function cashier_add() {
				layer.open({
				  type: 2,
				  title: '创建收银员',
				  shadeClose: true,
				  shade: 0.8,
				  area: ['500px', '620px'],
				  content: "{:url('store/cashier_add')}"
				}); 
			}
			function cashier_edit(id){
				var url='cashier_edit?id='+id;
				layer.open({
				  type: 2,
				  title: '编辑收银员',
				  shadeClose: true,
				  shade: 0.8,
				 area: ['500px', '620px'],
				  content:  [url]
				}); 
			}
			
			function cashier_del(id){
				$.ajax({
					type: "post",
					url: "{:url('store/cashier_del')}",
					data: {id:id}, //表单数据
					success: function(data) {
						layer.msg(data.msg, {
							icon: 1,
							time: 1500 //2秒关闭（如果不配置，默认是3秒）
						}, function() {
							window.parent.location.reload();
							var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
							parent.layer.close(index);
						});
					}
				});
			}
			
		</script>
	</body>

</html>